
from task.OperateDBHouse import OperateDBHouse
from task.MonitorLikeHouse import MonitorLikeHouse
from optparse import OptionParser
import sys
import os
from base_start import BaseStart


class HouseDbOper(BaseStart):

    def run(self):
        parser = OptionParser()
        parser.add_option("-t", "--type", dest="type",
                          help="xiaoqu or house")
        parser.add_option("-d", "--did", dest="destId",
                          help="id of xiaoqu or house")
        (options, args) = parser.parse_args()
        type, id = options.type, options.destId
        operator = OperateDBHouse()
        if type == "house":
            operator.set_house_like(id)
        elif type == "offline":
            operator.set_offline(id)
        elif type == "flush_desc":
            operator.flush_desc()
        elif type == "flush_bed":
            operator.flush_bed()
        else:
            operator.set_xiaoqu_like(id)


if __name__ == "__main__":
   h = HouseDbOper()
   h.run()